<style lang="less" scoped>
.component {
    .container {
        position: relative;
        height: 0.44rem;
        box-sizing: border-box;
        padding: 7px 0.15rem;
        background-color: #1b88ee;
        > div {
            height: 0.3rem;
            display: flex;
            align-items: center;
        }
    }
    .left {
        position: absolute;
        left: 25px;
        img {
            width: 14px;
        }
    }
    .center {
        margin-right: 50px;
        background-color: #fff;
        overflow: hidden;
        border-radius: 4px;
        form {
            width: 100%;
            height: 100%;
        }
        input {
            display: block;
            width: 100%;
            height: 100%;
            outline: none;
            border: none;
            font-size: 0.13rem;
            padding-left: 30px;
            box-sizing: border-box;
        }
    }
    .right {
        position: absolute;
        width: 0.5rem;
        right: 0;
        top: 50%;
        margin-top: -0.15rem;
        font-size: 0.15rem;
        color: #ffffff;
    }
}
</style>
<template>
    <div class="component">
        <div class="container">
            <div class="left">
                <img src="@/assets/icon/icon_search_gary.png" />
            </div>
            <div class="center">
                <form @submit="onSubmit">
                    <input type="text" v-model="keyword" placeholder="请输入查找类目" />
                </form>
            </div>
            <div class="right" @click="onCancle">取消</div>
        </div>
    </div>
</template>
<script>
import { HistorySearch } from "@/storage";
export default {
    data() {
        return {
            keyword: "",
            list: []
        };
    },
    methods: {
        onSubmit(e) {
            if (!this.keyword) {
                return false;
            }
            HistorySearch(this.keyword);
            this.$emit("onSearch", this.keyword);
            this.keyword = "";
            e.preventDefault();
            return false;
        },

        onCancle(){
            this.$emit("onCancle");
        }
    },
    mounted() {}
};
</script>
